var t = require("../../../mybehaviors/specs");

Component({
    behaviors: [ t ],
    properties: {
        show: {
            value: !1,
            type: Boolean
        },
        addCartBtn: {
            value: !0,
            type: Boolean
        },
        goodsInfo: {
            value: {},
            type: Object
        },
        isScanCode: {
            value: !1,
            type: Boolean
        }
    },
    data: {
        language: {},
        getMarketPrice: "",
        timeData: {},
        themeColor: "#f14e4e"
    },
    observers: {
        show: function(t) {
            t && (console.log("组件"), this.thisSpecsSetData());
        }
    },
    lifetimes: {
        attached: function() {},
        ready: function() {
            var t = this;
            try {
                wx.getStorage({
                    key: "langIndex",
                    success: function(e) {
                        console.log(e.data, 888), t.setData({
                            language: e.data.en
                        });
                    }
                }), wx.getStorage({
                    key: "yz_basic_info",
                    success: function(e) {
                        t.setData({
                            themeColor: e.data.theme_color,
                            getMarketPrice: e.data.lang.goods && e.data.lang.goods.market_price ? e.data.lang.goods.market_price : "",
                            getprice: e.data.lang.goods && e.data.lang.goods.price ? e.data.lang.goods.price : ""
                        });
                    }
                });
            } catch (t) {
                console.log(t);
            }
        }
    },
    methods: {
        closeCart: function() {
            this.triggerEvent("toOrderChild");
        },
        thisSpecsSetData: function() {
            var t = this, e = wx.getStorageSync("langIndex");
            this.setData({
                language: e.en,
                specsManage: [],
                optionsId: 0,
                goodsCount: 1
            }), this.data.isScanCode && setTimeout(function() {
                t.initPopView();
            }, 100);
        },
        storeAddCart: function() {
            this.triggerEvent("addCart", {
                goodsInfo: this.data.goodsInfo,
                optionsId: this.data.optionsId,
                goodsCount: this.data.goodsCount
            });
        },
        goodsCountBlur: function(t) {
            this.setData({
                goodsCount: Number(t.detail.value)
            });
        },
        popupSpecsbtn: function(t) {
            console.log(t), this.triggerEvent("closeShow"), this.setData({
                show: !1
            });
        },
        onChangeTime: function(t) {
            this.setData({
                timeData: t.detail
            });
        },
        addCart: function() {
            this.triggerEvent("addCart", this.data.goodsInfo);
        }
    }
});